package com.gagakuai.bpm.domian.events;

import org.apache.commons.lang3.time.DateFormatUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.event.ApplicationFailedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

import java.util.Date;

/*
 * @program: rep_server
 * @description: 系统启动失败监听器
 * @author: houhong
 * @create: 2021-12-02 17:08
 */
@Component
public class SystemStartFailedListener implements ApplicationListener<ApplicationFailedEvent> {


    private Logger logger = LoggerFactory.getLogger(SystemStartFailedListener.class);

    @Override
    public void onApplicationEvent(ApplicationFailedEvent event) {

        String pattern = "yyyy-MM-dd HH:mm:ss";
        String startUpTime = DateFormatUtils.format(new Date(), pattern);

        logger.warn("BPM系统启动失败！时间:{}", startUpTime);
        logger.warn("#失败事件:{}#", event);


    }
}